#ifndef __CEntityServer_H__
#define __CEntityServer_H__

#include "compfwk.h"

namespace compfwk
{
    class IEntity;

    /**
     * \brief Class that keep track of every entity created
     *
     * It's used to find an entity, by eid or type.
     * Deletion of entities is managed by the EntityServer
     */
    class CEntityServer
    {
    public:
        //! Returns the unique instance of the CEntityServer
        static CEntityServer& Instance( void );

        //! Add an entity to the server
        void AddEntity( IEntity* ap_ent );

        //! Find an entity by its eid
        IEntity* Find( const int a_eid );

    private:
        typedef CHashMap< int, IEntity* >::Ty CHMEnts;
        //======================= DATA MEMBERS ===========================
        //! Hash map that contains all the entities created
        CHMEnts m_hm_ents;

        //======================= METHODS ================================
        //! Default constructor
        CEntityServer( );

        //! Desrtructor
        ~CEntityServer( );

        //! Copy constructor
        CEntityServer( const CEntityServer& ar_ent_srv );

        //! Assignment operator
        CEntityServer& operator =( const CEntityServer& ar_ent_srv );
    };
}
#endif